package com.pactera.madp.cp.handler;

import com.alibaba.ttl.TransmittableThreadLocal;
import lombok.experimental.UtilityClass;

/**
 * 企业id应用工具类
 */
@UtilityClass
public class CorpContextHolder {

    private final Boolean sign = false;

    private final static ThreadLocal<Integer> CORP_LOCAL_TENANT = new TransmittableThreadLocal<>();

    public void setCorpId(Integer corpId){
        CORP_LOCAL_TENANT.set(corpId);
    };

    public Integer getCorpId(){
        return CORP_LOCAL_TENANT.get();
    }

    public void remove(){
        CORP_LOCAL_TENANT.remove();
    }

    public Integer getCorpId1() {
        if (sign) {
            return 2;
        } else {
            return getCorpId();
        }
    }

}
